import java.util.Scanner;

/**
 * IDE: Eclipse
 *
 * @author Justin Niles
 * @author Grant Foster
 * @author Bryce Langlotz
 * @author Max Honosky
 *
 */
public class Main {
	public static String inputFilePath = "";
	public static String outputFilePath = "";
	public static float probeRadius = 0;
	public static float resolution = 0;

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);

		// Prompt user for input values
		System.out.println("Input File Path:");
		Main.inputFilePath = input.nextLine();
		System.out.println("Output File Path:");
		Main.outputFilePath = input.nextLine();
		System.out.println("Resolution:");
		resolution = Float.parseFloat(input.nextLine());
		System.out.println("Probe Radius:");
		probeRadius = Float.parseFloat(input.nextLine());

		input.close();

		Long startTime = System.currentTimeMillis();
		AtomArray aa = FileReader.getAtoms();

		CavityCalculator cc = new CavityCalculator(aa, resolution, probeRadius);
		System.out.println("\nCalculating...");
		cc.calculateAtomIntersections();

		// Used for debugging purposes:
		// System.out.println("\nPrint out graphic representation of resGrid? (y/n)");
		// if (input.next().equalsIgnoreCase("y"))
		// {
		// cc.printResGrid();
		// }

		CVSearch cvSearch = new CVSearch(cc.resGrid, cc.xGridLength,
				cc.xGridLength, cc.zGridLength);
		cvSearch.findVoids();

		Long timeTaken = System.currentTimeMillis() - startTime;
		System.out.println("\nTime to Completion: " + timeTaken + "ms");

		WriteToFile.writeToFile(cvSearch.findCavities());

	}
}
